﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<PagedList<CourseSystem.Core.Entities.TopicsInfo>>" %>
<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<%@ Import Namespace="CourseSystem.Core.Enum" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>

<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
    <tr>
        <td width="426" height="25" bgcolor="#D1E5F0">
            <div align="center" class="style13">
                标题</div>
        </td>
        <td width="194" bgcolor="#D1E5F0">
            <div align="center">
                <span class="style5">作者</span></div>
        </td>
        <td width="130" bgcolor="#D1E5F0">
            <div align="center">
                <span class="style13">查看/回复</span></div>
        </td>
        <td width="184" bgcolor="#D1E5F0">
            <div align="center">
                <span class="style13">最后发表</span></div>
        </td>
    </tr>
    <% int i = 1;

       foreach (var item in Model)
       {

           var isTodayPost = TopicsHelper.IsTodayHasPost(item);
           var icon = isTodayPost ? 1 : 2;
           if (item.Status == 1)
               icon = 4;
           else
               if (item.Views > 200 || item.Replies > 20)
                   icon = 3;
           
           
    %>
    <tr class="style1">
        <td height="35">
            <table width="417" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="8">
                        &nbsp;
                    </td>
                    <td width="21">
                        <img src="<%=ResolveUrl("~/Content/images/"+icon+".jpg") %>" width="21" height="26" />
                    </td>
                    <td width="13">
                        &nbsp;
                    </td>
                    <td width="375">
                        <div align="left">
                            <span class="style15">
                                <%=Html.ActionLink(item.Title, "PostsView", new {item.Fid, item.Id,isDigest=ViewData["isDigest"]})%></span></div>
                    </td>
                </tr>
            </table>
        </td>
        <td>
            <div align="center" class="style16">
                <%=item.PosterName %></div>
        </td>
        <td>
            <div align="center" class="style16">
                <%=item.Views %>/<%=item.Replies %></div>
        </td>
        <td>
            <div align="center" class="style16">
                <%=item.LastPosterName %>
            </div>
        </td>
    </tr>
    <% } %>
</table>
<table width="98%" height="7" border="0" align="center" cellpadding="0" cellspacing="0"
    bordercolor="#FFFFFF">
    <tr>
        <td class="gray12">
            &nbsp;
        </td>
        <td align="right" class="gray12">
            <%=Html.AjaxPager(Model, new PagerOptions() { ContainerTagName = "span", CssClass = "mvcPager", PageIndexParameterName = "pid", ShowMorePagerItems = false, AlwaysShowFirstLastPageNumber = true, }, new AjaxOptions() { UpdateTargetId = "listDiv" })%>
            共<%=Model.TotalItemCount %>条记录，页<%=Model.CurrentPageIndex %>/<%=Model.TotalPageCount %>
        </td>
    </tr>
</table>
